<?php
/**
 * Here is your custom functions.
 */


 function mqtt_publish($topic, $content) {
    static $mqtt = false;
    if (!$mqtt) {
        // $mqtt = new Workerman\Mqtt\Client(config('mqtt.server'), config('mqtt.options'));
        $mqtt = new Workerman\Mqtt\Client('mqtt://39.100.68.212:1883',[
            'username' => 'admin',
            'password' => '111111'
        ]);
        $mqtt->connect();
    }
    $mqtt->publish($topic, $content);
}